<?php
/**
 * Created by PhpStorm.
 * User: 15814
 * Date: 2018/9/26
 * Time: 17:19
 */

include "config.php";
session_start();
if ($_SERVER["REQUEST_METHOD"]=="POST"){
    $utel=$_POST["utel"];
    $upwd=$_POST["upwd"];
    $sql="SELECT * FROM userinfo WHERE uTel=? AND uPwd=?";
    $ready=$conn->prepare($sql);
    $ready->bind_param("ss",$utel,$upwd);
    $ready->execute();
    $res=$ready->get_result();
    if ($res->num_rows>=1){
        $_SESSION["userInfo"]=$res->fetch_assoc();
        print_r(json_encode(Array("stu"=>1,"msg"=>"登陆成功")));
    }
    else{
        print_r(json_encode(Array("stu"=>0,"msg"=>"登陆失败")));
    }

}
else{
    print_r(json_encode(Array("stu"=>0,"msg"=>"请求方式错误")));
}